package com.deruan.hotcore.resource.table.plugin;

import java.awt.Component;

import javax.swing.JTable;

import com.deruan.hotcore.base.common.bean.ResourceBean;
import com.deruan.hotcore.resource.gui.tree.ResourceTreeNode;

public class ResourceSubjectRenderer extends ResourceDefaultLabelRendrer
{
	public ResourceSubjectRenderer()
	{
		super();
	}
	public Component getTableCellRendererComponent(JTable table, Object value,
	        boolean isSelected, boolean hasFocus, int row, int column) 
	{
		super.getTableCellRendererComponent(table, value, isSelected, hasFocus,
				row, column);

        if (value == null) {
            setText("");
            return this;
        }

       ResourceBean bean = ((ResourceTreeNode) value).getResourceBean();
       if(bean!=null)
       {
    	   setText(bean.getTitle());
       }
      else 
      {
		setText("");
	  }
		return this;
	}
}
